{% extends "menu.html" %}
{% block content %}

        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">



            </div>
            <div class="clearfix"></div>
            <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>新增命令</h2>

                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <br />
                    <form id="demo-form2" data-parsley-validate class="form-horizontal form-label-left" method="post">
                        {% csrf_token %}
                      <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">命令<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input type="text" id="first-name" required="required" class="form-control col-md-7 col-xs-12" name="cmd_command">
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">命令类型<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <select name="cmd_type" size="4" style="width: 60%;height: 100%;font-size: 15px">
                              <option value="1">cmd.run</option>
                              <option value="2">state.sls</option>
                              <option value="3">scripts</option>
                          </select><br>
                            cmd.run的类型表示salt “*” cmd.run "df -h"<br>
                            state.sls的类型表示salt "*" state.sls game_init<br>
                            scripts 的类型表示表示平台执行脚本<br>
                            命令只需要写cmd.run或者state.sls后面的字符串<br>

                        </div>
                      </div>

                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                          <button class="btn btn-primary" type="button">Cancel</button>
						  <button class="btn btn-primary" type="reset">Reset</button>
                          <button type="submit" class="btn btn-success">Submit</button>
                        </div>
                      </div>

                    </form>
                  </div>
                </div>
                  <div class="x_panel">
                  <div class="x_title">
                    <h2>命令列表</h2>

                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <br />
                    <table class="sui-table table-bordered">
                          <thead>
                            <tr>
                                <th>ID</th>
                                <th>命令</th>
                                <th>类型</th>
                                <th>管理 </th>


                            </tr>
                          </thead>
                          <tbody>
                          <style type="text/css">
                             tr:hover{
                                 background-color: #FFFFE0;
                             }
                          </style>
                          {% for i in cmd_list %}
                            <tr>

                                <td>{{ i.id}}</td>
                                <td>{{ i.cmd_command }}</td>
                                {% if i.cmd_type == "1"  %}
                                <td>cmd.run</td>
                                {% elif i.cmd_type == "2" %}
                                    <td>state.sls</td>
                                {% elif i.cmd_type == "3" %}
                                    <td>scripts </td>
                                {% endif %}
                                <td><a href="/saltconfig/cmddel/?id={{ i.id}}" class="label label-danger" >删除</a></td>
                            </tr>
                        {% endfor %}
                          </tbody>
                      </table>
                  </div>
                </div>
              </div>
            </div>


          </div>
        </div>
{% endblock %}